<?php 
header("Content-type: text/html; charset=utf-8");
$levels =@mysql_connect('localhost','root','')
      or die('数据库无法连接');
@mysql_select_db('neu-video',$levels)
      or die('数据库不存在');
mysql_set_charset('utf8');
$sql = 'select levels.* from levels join users on levels.uid=users.uid 
join videos on levels.vid=videos.vid';
$result = mysql_query($sql,$levels);
$levels = fetch_array($result);
echo '<table border="1">';
echo '<caption>视频评分表</caption>';
echo '<tr>
  <th>级别ID</th>
  <th>视频ID</th>
  <th>打分用户</th>
  <th>评分</th>
</tr>';
foreach ($levels as $one) {
	echo '<tr>';
	echo '<td>'.$one['lid'].'</td>';
	echo '<td>'.$one['vid'].'</td>';
  echo '<td>'.$one['uid'].'</td>';
  echo '<td>'.$one['score'].'</td>';
	echo '</tr>';
}
function fetch_array($Results){
	$arrs = array();
    while ($Results && ($row = mysql_fetch_assoc($Results))!==FALSE) {
	       $arrs[] = $row;
          }
    return $arrs;
	
}
 ?>